<template>
<div class="layerRtb layerRtb-threecolumn layerRtb-right">
    <three-title :title="{name:'订单确认'}" :close="false">
        <span tag="i" class="rig_close fr" @click="$parent.$parent.clickFiveShow()"></span>
    </three-title>
    <ul class="clearfix uiTab5">
        <li :class="['fl', currentIndex === 80 ? 'uiTab5-active' : '']" @click="tabClick(80)">用电安全<i class="uiTab-i"></i></li>
        <li :class="['fl', currentIndex === 82 ? 'uiTab5-active' : '']" @click="tabClick(82)">消防安全<i class="uiTab-i"></i></li>
        <li :class="['fl', currentIndex === 83 ? 'uiTab5-active' : '']" @click="tabClick(83)">设备安全<i class="uiTab-i"></i></li>
        <li :class="['fl', currentIndex === 84 ? 'uiTab5-active' : '']" @click="tabClick(84)">人员安全<i class="uiTab-i"></i></li>
        <li :class="['fl', currentIndex === 88 ? 'uiTab5-active' : '']" @click="tabClick(88)" v-if="twoToThreeInfo.orderTypeId === 42">安全教育<i class="uiTab-i"></i></li>
    </ul>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "28" v-loading="loading">
        <div class="analyItem" v-for="(item, index) in currentList" :key="index">
            <p class="analyItemTit tx-center">{{item.standard_name}}</p>
            <div class="analyItemCon">
                <div class="analyItemflex">
                    <rx-viewer style="position:relative">
                        <div class="clearfix tx-center">
                            <div class="mr10">
                                <img :src="item.picturePath | smallImg(80, 80)">
                                <span class="standardStyle">标</span>
                            </div>
                        </div>
                    </rx-viewer>
                    <div>{{item.content}}</div>
                </div>
            </div>
        </div>
        <div class="analyItem" v-if="currentList.length === 0">
            <p class="analyItemTit tx-center">暂无数据</p>
            <div class="analyItemCon">
                <span>暂无数据</span>
            </div>
        </div>
    </div>
    <!-- <div class="layerRtb-footer">
        <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
            </div>
        </div>
    </div> -->
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getFindSafetyOrderStandard } from '../../../../Resources/Api/scene'
export default {
    props: ['Projectcode', 'type', 'role'],
    data () {
        return {
            loading: false, // 加载loaidng
            currentIndex: 80, // 当前的index
            currentList: [], // 当前的数据
            dataList: [], // 全部数据
            equipmentSafeData: [], // 用电
            personnelSafeData: [], // 人员
            fireSafeData: [], // 消防
            electricSafeData: [], // 设备
            educationSafeDate: [] // 教育
        }
    },
    created () {
        this.getFindSafetyOrderStandard()
    },
    computed: {
        ...mapGetters(['leftInfo', 'twoToThreeInfo'])
    },
    methods: {
        tabClick (index) {
            this.currentIndex = index
            switch (index) {
            case 83:
                this.currentList = this.equipmentSafeData
                break
            case 84:
                this.currentList = this.personnelSafeData
                break
            case 82:
                this.currentList = this.fireSafeData
                break
            case 80:
                this.currentList = this.electricSafeData
                break
            case 88:
                this.currentList = this.educationSafeDate
                break
            default:
                break
            }
        },
        getFindSafetyOrderStandard () {
            this.loading = true
            let parm = {
                projectOrderCode: this.Projectcode
            }
            // 接口订单数据
            getFindSafetyOrderStandard(parm).then(results => {
                if (results.data.StatusCode === 1) {
                    this.dataList = results.data.Body.safeList

                    // 设备安全数据
                    this.equipmentSafeData = this.dataList.filter(function (item) {
                        return item.worker_type_Id === 83
                    })
                    // 人员安全数据
                    this.personnelSafeData = this.dataList.filter(function (item) {
                        return item.worker_type_Id === 84
                    })
                    // 消防安全数据
                    this.fireSafeData = this.dataList.filter(function (item) {
                        return item.worker_type_Id === 82
                    })
                    // 用电安全数据
                    this.electricSafeData = this.dataList.filter(function (item) {
                        return item.worker_type_Id === 80
                    })
                    // 安全教育数据
                    this.educationSafeDate = this.dataList.filter(function (item) {
                        return item.worker_type_Id === 88
                    })
                    this.currentList = this.electricSafeData
                    this.loading = false
                }
            }).catch(error => {
                console.log(error)
            })
        }
    },
    watch: {
        $route () {
            this.getFindSafetyOrderStandard()
        }
    }
}
</script>
